import request from '@/utils/request'

// 常量
const api_name = '/admin/system/sysRole'

export default {
  // 列表
  getPageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  // 删除
  removeId(id) {
    return request({
      url: `${api_name}/remove/${id}`,
      method: 'delete'
    })
  },
  // 添加
  saveRole(role) {
    return request({
      url: `${api_name}/save`,
      method: 'post',
      data: role
    })
  },
  // 根据id查询
  getRoleId(id) {
    return request({
      url: `${api_name}/findRoleById/${id}`,
      method: 'post'
    })
  },
  // 修改
  updateRole(role) {
    return request({
      url: `${api_name}/update`,
      method: 'post',
      data: role
    })
  },
  // 批量删除
  batchRemove(idList) {
    return request({
      url: `${api_name}/batchRemove`,
      method: 'delete',
      data: idList
    })
  },
  /*
  查看某个角色的权限列表
  */
  toAssign(roleId) {
    return request({
      url: `${api_name}/toAssign/${roleId}`,
      method: 'get'
    })
  },

  /*
  给某个角色授权
  */
  doAssign(assginMenuVo) {
    return request({
      url: `${api_name}/doAssign`,
      method: 'post',
      data: assginMenuVo
    })
  }

}

